-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Router Service] routeWillChange & routeDidChange #17025
Conversation
@@ -148,7 +150,17 @@ export default class RouterService extends Service { | |||
} | |||
} | |||
|
|||
RouterService.reopen({ | |||
RouterService.reopen(Evented, { | |||
init() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move the init
up into the main class body, and leave the .reopen(Evented)
here?
@@ -329,7 +329,7 @@ class Route extends EmberObject implements IRoute { | |||
/** | |||
@private | |||
|
|||
@method _reset | |||
@method _internalReset | |||
@since 1.7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I think this @since
is also wrong
false, | ||
{ | ||
id: 'deprecate-router-events', | ||
until: '3.9.0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to be 4.0.0, didTransition
and willTransition
were public API's.
false, | ||
{ | ||
id: 'deprecate-router-events', | ||
until: '3.9.0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
until: '4.0.0'
@@ -1793,4 +1823,37 @@ EmberRouter.reopen(Evented, { | |||
}), | |||
}); | |||
|
|||
if (EMBER_ROUTING_ROUTER_SERVICE) { | |||
if (ROUTER_EVENTS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you collapse these two conditionals?
if (EMBER_ROUTING_ROUTER_SERVICE && ROUTER_EVENTS) {
@@ -257,6 +259,34 @@ class EmberRouter extends EmberObject { | |||
return triggerEvent.bind(router)(routeInfos, ignoreFailure, name, args); | |||
} | |||
|
|||
routeWillChange(transition: Transition) { | |||
if (EMBER_ROUTING_ROUTER_SERVICE) { | |||
router.trigger('routeWillChange', transition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new routeWillChange
/ routeDidChange
events need documentation. Can you add that to the meta issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the documentation for this. Not sure if its good enough though. I will add it to the list. Also need to document to
and from
fields on the transition. Need to also mark Transition
as public.
5447d27
to
9e31a44
Compare
This removes the FF around all the router service features that were go'd earlier this year. It also reuses the same flag to guard the new features that we are adding.
This adds the
routeWillChange
&routeDidChange
events. It also exposesto
andfrom
fields on the transition object. These properties point to aRouteInfo
object that looks like:This also deprecates
didTransition
andwillTransition
.This should land after #17007